package com.example.javademo;

import android.os.Bundle;
import android.util.Log;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
        Log.d("tag", "onCreate: 创建");
    }

    // ----------------------------
    // 生命周期方法
    // ----------------------------

    @Override
    protected void onStart() {
        super.onStart();
        System.out.println("启动");
    }

    @Override
    protected void onResume() {
        super.onResume();
        System.out.println("恢复");
    }

    @Override
    protected void onPause() {
        super.onPause();
        System.out.println("暂停");
    }

    @Override
    protected void onStop() {
        super.onStop();
        System.out.println("停止");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        System.out.println("销毁");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
    }


}
